/**
 * 给一个时间戳,返回距离现在多久了
 * @param time 一个时间戳
 * @returns {*} 时间差
 */
export function returnTime(time) {
  if (isNaN(time) === true) return "Error!" + '"' + time + '"' + " is NaN";
  if (time < 0) return "Error! 过去的时间大于现在的时间!";
  else {
    var diffValue = (Date.now() - time) / 1000 / 60;
    if (diffValue < 1) return "刚刚";
    if (diffValue < 60) return parseInt(diffValue) + "分钟";
    if (diffValue < 60 * 24) return parseInt(diffValue / 60) + "小时";
    if (diffValue < 60 * 24 * 30) return parseInt(diffValue / 60 / 24) + "d";
    return "很久";
  }
}
